<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
        <input v-model="msg" />
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
      var vm = new Vue({
        el: '#app',
        data: {
            msg:'hello world'
        },
        methods: {},
        watch:{
            // msg:function(){
            //     console.log(123)
            // }
            msg:{
                handler:function(){
                    console.log(123)
                },
                //能实现第一次也会执行
                immediate:true 
            }
        }
      })
    </script>
  </body>
</html>
